package org.vizzini.xwingminiatures.swingui;

import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.WindowConstants;

import org.vizzini.xwingminiatures.TestData;
import org.vizzini.xwingminiatures.XWingEngine;
import org.vizzini.xwingminiatures.XWingEnvironment;
import org.vizzini.xwingminiatures.XWingGameInjector;

/**
 * Provides tests for the <code>XWingEnvironmentUI</code> class.
 */
public final class MyTestXWingEnvironmentUI extends JFrame
{
    /**
     * Application method.
     * 
     * @param args Application arguments.
     */
    public static final void main(final String[] args)
    {
        EventQueue.invokeLater(new Runnable()
        {
            @Override
            public void run()
            {
                final MyTestXWingEnvironmentUI app = new MyTestXWingEnvironmentUI();
                app.setVisible(true);
            }
        });
    }

    /** Test data. */
    private final TestData testData = new TestData();

    /**
     * Construct this object.
     */
    public MyTestXWingEnvironmentUI()
    {
        final XWingGameInjector injector = new XWingGameInjector();
        final XWingEngine engine = injector.injectEngine();
        final XWingEnvironment environment = testData.createEnvironment();
        final XWingEnvironmentUI environmentUI = new XWingEnvironmentUI(engine, environment);

        setTitle("Vizzini X-Wing Miniatures");
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        getContentPane().add(environmentUI, BorderLayout.CENTER);
        pack();
        setLocationRelativeTo(null);
    }
}
